//
//  InquiryView.m
//  
//
//  Created by chris on 15/12/26.
//
//

#import "InquiryView.h"
#import "MyButton.h"
#import "UIView+Extension.h"

@implementation InquiryView
- (instancetype)initWithFrame:(CGRect)frame
{
    [self removeAllSubViews];
    self = [super initWithFrame:frame];
    if (self)
    {
        UIImageView * verLine = [[UIImageView alloc]initWithFrame:CGRectMake(frame.size.width/2-0.5,0, 1, frame.size.height)];
        verLine.backgroundColor = [UIColor colorWithRed:0.89 green:0.89 blue:0.89 alpha:1];
        [self addSubview:verLine];
        
        NSArray * titles = @[@"门店信息",@"工单列表"];
        NSArray * icons =  @[@"haocai",@"haoka"];
        for (int i = 0; i < 2; i++)
        {
            
            MyButton * button = [[MyButton alloc]initWithFrame:CGRectMake(20+((DEF_SCREEN_WIDTH-1)/2)*i, 20, DEF_SCREEN_WIDTH/2-41,  frame.size.height-40)];
            if (DEF_SCREEN_HEIGHT <= 568)
            {
                button.frame = CGRectMake(20+((DEF_SCREEN_WIDTH-1)/2)*i, 10, DEF_SCREEN_WIDTH/2-41, frame.size.height-20);
            }
//            button.backgroundColor = [UIColor lightGrayColor];
            button.tag = 110+i;
            [button addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
            button.titleLa.text = titles[i];
            [button setUiImage:[UIImage imageNamed:icons[i]]];
            [self addSubview:button];
        }
    }
    return self;
}
#pragma mark-点击事件
- (void)click:(UIButton *)btn
{
    int myIndex = btn.tag%110;
    if (self.delegate && [self.delegate respondsToSelector:@selector(inClickWithIndex:)])
    {
        [self.delegate inClickWithIndex:myIndex];
    }
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
